import { Component, Inject, ChangeDetectionStrategy } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';
import { MatButtonModule } from '@angular/material/button';
import { TranslateModule } from '@ngx-translate/core';
import { DialogComponent } from '@shared/components/dialog.component';
import { SafePipe } from '@shared/pipe/safe.pipe';
import { TruncateWithTooltipDirective } from '@shared/directives/truncate-with-tooltip.directive';

export interface ConfirmDialogData {
  title: string;
  message: string;
  cancel: string;
  ok: string;
}

/**
 * 确认对话框组件
 * 
 * 显示确认提示对话框，用户可以取消或确认操作
 */
@Component({
  selector: 'cne-confirm-dialog',
  standalone: true,
  imports: [CommonModule, MatDialogModule, MatButtonModule, TranslateModule, SafePipe, TruncateWithTooltipDirective],
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: './confirm-dialog.component.html',
  styleUrls: ['./confirm-dialog.component.scss']
})
export class ConfirmDialogComponent extends DialogComponent<ConfirmDialogComponent, boolean> {
  constructor(
    public override dialogRef: MatDialogRef<ConfirmDialogComponent>,
    @Inject(MAT_DIALOG_DATA) public data: ConfirmDialogData
  ) {
    super(dialogRef);
  }
}
